package lc.oa.ui.fragment;

import android.os.Bundle;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;

import lc.oa.App;
import lc.oa.R;
import lc.oa.data.model.LoggedInUser;
import lc.oa.ui.base.BaseFragment;
/**
  *
  * @Description:     我的页面处理逻辑
  * @Author:         lucifer
  * @CreateDate:     2020/8/7 16:13
  * @UpdateUser:
  * @UpdateDate:
  * @UpdateRemark:
  * @Version:        1.0
 */
public class MyFragment extends BaseFragment implements ViewPager.OnPageChangeListener {
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_my, container, false);
        bindUserInfo(view);
        return view;
     }

    private void bindUserInfo(View view) {
       LoggedInUser users =App.getLoggedInUser();
       if (null!=users){
           TextView tvUserName=view.findViewById(R.id.tv_username);
           TextView tvEmployee=view.findViewById(R.id.tv_EmployeeNo);
           TextView tvMobile=view.findViewById(R.id.tv_Mobile);
           TextView tvPositionName=view.findViewById(R.id.tvPositionName);
           TextView tvEmail=view.findViewById(R.id.tvEmail);
           TextView tvDepName=view.findViewById(R.id.tv_DepName);

           //TextView tvUserName=view.findViewById(R.id.tv_username);
           tvUserName.setText(users.getUserName());
           tvEmployee.setText(users.getEmployeeNo());
           tvMobile.setText(users.getMobile());
           tvPositionName.setText(users.getPositionName());
           tvEmail.setText(users.getEmail());
           tvDepName.setText(users.getDepName());
       }
    }

    @Override
    protected void handlerMessage1(Message msg) {

    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initControl() {

    }

    @Override
    public void onModeChanged(int action, Object... values) {

    }

    @Override
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

    }

    @Override
    public void onPageSelected(int position) {

    }

    @Override
    public void onPageScrollStateChanged(int state) {

    }
}
